<template>
	<view class="mymessage">
		<none v-if="message.length===0"></none>
	<!-- 	<view class="none" v-if="message.length===0">
			<image src="/static/images/none.png" mode=""></image>
		</view> -->
		<view class="message" v-else v-for="(item,index) in message" :key="item.id">
			<view class="time">
				{{item.created_at}}
			</view>
			<view class="text">
				{{item.data.message}}
			</view>
		</view>
	</view>
</template>

<script>
	import none from '@/components/none.vue'
	import {getUserMessage} from '@/request/user.js'
	export default{
		components:{none},
		data(){
			return{
			page:1,
			page_size:10,
			message:[]
			}
		},
		onLoad: function (options) {
		       setTimeout(function () {
		           console.log('下拉刷新');
		       }, 500);
		       uni.startPullDownRefresh();
		   },
		   onPullDownRefresh() {
		       console.log('停止刷新');
		       setTimeout(function () {
		           uni.stopPullDownRefresh();
		       }, 500);
		   },
		onShow() {
			
		},
		onShow() {
			this.getMessage()
		},
		methods:{
		async getMessage(){
			let res = await getUserMessage({
				page:this.page,
				page_size:this.page_size
			})
			console.log(res)
			this.message = res.data.data.data
			console.log(this.message)
		}
		}
	}
</script>

<style lang="less">
	body{
		background-color: #f2f2f2;
	}
	.mymessage{
		background-color: #fff;
		.message{
			height: 250rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			.time{
				font-size: 30rpx;
				color: #adadad;
			}
			.text{
				margin-top: 20rpx;
				font-size: 36rpx;
				color: #909090;
			}
		}
		.none{
			background-color: #fff;
			height: 600rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			image{
				width: 500rpx;
				height: 500rpx;
			}
		}	
	}
</style>
